package model;

import java.util.ArrayList;
import java.util.List;

public abstract class IModel {

    protected int index = 0;
    protected List<String> list = new ArrayList<>();
    
    public IModel(){
        initTypes(list);
    }

    /**
     * 初始化模式
     * @return
     */
    protected abstract void initTypes(List<String> list);

    public List<String> getTypes(){
        return list;
    }

    public void setType(int type){
        this.index = type;
    }

    public int getType(){
        return index;
    }

    public String getTypeStr(){
        if (list.isEmpty()){
            return "默认";
        }else{
            return getTypes().get(index);
        }
    }

    /**
     * 将输入转为输出并返回
     * @param input
     * @return
     */
    public abstract String change(String input);

}
